package com.eddie.proxy.dynamic;

/**
 * @author Eddie
 * @date 2022/08/03 09:29
 **/
public class Client {
    public static void main(String[] args) {
        ProxyFactory proxyFactory = new ProxyFactory(new TeacherDao());
        //强制转换为想要的类型
        ITeacherDao proxyInstance = (ITeacherDao) proxyFactory.getProxyInstance();


        //class jdk.proxy1.$Proxy0 内存中动态生成了代理对象
        System.out.println(proxyInstance.getClass());

        //通过代理对象调用目标对象的方法
        proxyInstance.teach();
        proxyInstance.sayHello("Eddie");

    }
}
